CORELIB_NAME=libgraph.so
CORELIB_FILES=src/node.cpp src/graph.cpp src/fcp.cpp src/plandwriter.cpp
CORELIB_OBJECTS	= $(CORELIB_FILES:src/%.cpp=%.o)

CORELIB_COMPILE_FLAGS= -Wall -fPIC -O2 -I../tinyxml/
CORELIB_LIBS= -ltinyxml  -L../build
CORELIB_LINK_FLAGS= -shared -Wl,-soname,$(CORELIB_NAME) $(CORELIB_LIBS) -o $(CORELIB_NAME)
CPP=g++
MAKE=make

all: slib

system: slib
	cp $(CORELIB_NAME) ../build/

%.o: src/%.cpp
	$(CPP) $(CORELIB_COMPILE_FLAGS) -c -o $@  $< $(CXXFLAGS)

slib: $(CORELIB_OBJECTS)
	$(CPP) $(CORELIB_LINK_FLAGS) $(CORELIB_OBJECTS)


.PHONY	: clean open

clean:
	rm -rf $(CORELIB_OBJECTS) $(CORELIB_NAME) doc/ testbench log.txt

open:
	geany  src/*.cpp lib/*.hpp &

test:  $(CORELIB_OBJECTS)
	g++ src/main.cpp -Wl,--rpath,. -I../tinyxml/ $(CORELIB_OBJECTS) $(CORELIB_LIBS) -o testbench
